package com.ourcraft.informationcollectionsystem.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;
import java.util.Date;

import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@TableName("Message")
public class Message {
    @TableId(type = IdType.AUTO)
    private Integer messageId;
    private Integer userId;
    private String messageTitle;
    private String messageContent;
    @TableField(value = "message_time", jdbcType = JdbcType.TIMESTAMP)
    private Date messageTime;
    private String messageDepartment;
    private Boolean messageRead;

    public Message(Integer userId, String messageTitle, String messageContent, String messageDepartment){
        this.userId = userId;
        this.messageTitle = messageTitle;
        this.messageContent = messageContent;
        this.messageDepartment = messageDepartment;
        this.messageTime = new Date();
        this.messageRead = false;
    }
}
